%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ptx.tab.h"
%}

%token SEMICOLON
%token COMMA
%token L_BRACE R_BRACE L_PAREN R_PAREN
%token ASSGN
%token ADDOP MULOP LTOP LTOEQOP EQOP GTOEQOP GTOOP
%token VIZ ENTRY
%token REG PARAM U32 F32
%token IDENTIFIER INTEGER

%%

program:
    targets entries
    {
        printf("Parsing complete\n");
    }
    ;

targets:
    targets VIZ ASSGN IDENTIFIER SEMICOLON
    | /* empty */
    ;

entries:
    entries entry
    | entry
    ;

entry:
    ENTRY IDENTIFIER L_PAREN parameters R_PAREN
    L_BRACE statements R_BRACE
    ;

parameters:
    parameters param
    | param
    | /* empty */
    ;

param:
    PARAM U32 IDENTIFIER
    | PARAM F32 IDENTIFIER
    ;

statements:
    statements statement
    | statement
    ;

statement:
    REG U32 IDENTIFIER SEMICOLON
    | IDENTIFIER ASSGN INTEGER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER ADDOP IDENTIFIER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER ADDOP INTEGER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER MULOP IDENTIFIER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER MULOP INTEGER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER LTOP IDENTIFIER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER LTOP INTEGER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER LTOEQOP IDENTIFIER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER LTOEQOP INTEGER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER EQOP IDENTIFIER SEMICOLON
    | IDENTIFIER ASSGN IDENTIFIER EQOP INTEGER SEMIC